package repository

import (
	"context"
	"xs.jsjb/internal/app/user/entity"
)

// GetUserByName 根据用户名查询用户
func (u *userRepo) GetUserByName(ctx context.Context, userName string) (user *entity.User, err error) {
	user = new(entity.User)
	if err = u.db.WithContext(ctx).Where("username = ?", userName).First(user).Error; err != nil {
		return
	}
	return
}
